'use strict';

var app = angular.module('app')
	.config(['$stateProvider', '$urlRouterProvider', '$httpProvider', function($stateProvider, $urlRouterProvider, $httpProvider) {
		//解决界面缓存问题
		if(!$httpProvider.defaults.headers.get) {
			$httpProvider.defaults.headers.get = {};
		}
		$httpProvider.defaults.headers.common["X-Requested-With"] = "XMLHttpRequest";
		$httpProvider.defaults.headers.get['Cache-Control'] = "no-cache";
		$httpProvider.defaults.headers.get['Pragma'] = "no-cache";
		// 默认地址
		$urlRouterProvider.otherwise('/access/login');
		// 状态配置
		$stateProvider
			.state('main', {
				abstract: true,
				url: '',
				templateUrl: 'src/tpl/app.html'
			})
			.state('access', {
				url: '/access',
				template: '<div ui-view class="fade-in-right-big smooth"></div>'
			})
			.state('access.login', {
				url: '/login',
				templateUrl: 'src/app/sys/login/login.html',
				controller: 'loginController',
				resolve: {
					deps: ['uiLoad', '$ocLazyLoad', function(uiLoad, $ocLazyLoad) {
						return uiLoad.load('src/app/sys/login/loginController.js').then(function() {
							return $ocLazyLoad.load('toaster');
						});
					}]
				}
			})
			.state('access.forgetPassword', {
				url: '/update',
				templateUrl: 'src/app/sys/login/forgetPassword.html',
				controller: 'fPasswordController',
				resolve: {
					deps: ['uiLoad', '$ocLazyLoad', function(uiLoad, $ocLazyLoad) {
						return uiLoad.load('src/app/sys/login/forgetPasswordController.js').then(function() {
							return $ocLazyLoad.load('toaster');
						});
					}]
				}
			})
			.state('main.sys.log', {
				url: '/log',
				template: '<div ui-view class="fade-in-right-big smooth"></div>'
			})
			.state('main.sys.log.list', {
				url: '/list',
				templateUrl: 'src/app/sys/log/log.html',
				controller: 'logController',
				resolve: {
					deps: ['uiLoad', '$ocLazyLoad', function(uiLoad, $ocLazyLoad) {
						return uiLoad.load('src/app/sys/log/logController.js').then(function() {
							return $ocLazyLoad.load('toaster');
						});
					}]
				}
			})
			.state('main.sys.log.detail', {
				url: '/detail/{id}?params',
				templateUrl: 'src/app/sys/log/logDetail.html',
				controller: 'detailController',
				resolve: {
					deps: ['uiLoad', '$ocLazyLoad', function(uiLoad, $ocLazyLoad) {
						return uiLoad.load('src/app/sys/log/detailController.js').then(function() {
							return $ocLazyLoad.load('toaster');
						});
					}]
				}
			})
			.state('main.sys', {
				url: '/sys',
				template: '<div ui-view class="fade-in-right-big smooth"></div>'
			}) // 用户
			.state('main.sys.user', {
				url: '/user',
				template: '<div ui-view class="fade-in-right-big smooth"></div>'
			})
			.state('main.sys.user.list', {
				params: {
					'regionId': null,
					'regionName': null
				},
				url: '/list',
				templateUrl: 'src/app/sys/user/user.html',
				controller: 'userController',
				resolve: {
					deps: ['uiLoad', '$ocLazyLoad', function(uiLoad, $ocLazyLoad) {
						return uiLoad.load('src/app/sys/user/userController.js').then(function() {
							return $ocLazyLoad.load('toaster');
						});
					}]
				}
			})
			.state('main.sys.user.create', {
				url: '/create/{regionId}/{regionName}?params',
				templateUrl: 'src/app/sys/user/update.html',
				controller: 'userUpdateController',
				resolve: {
					deps: ['uiLoad', '$ocLazyLoad', function(uiLoad, $ocLazyLoad) {
						return uiLoad.load('src/app/sys/user/updateController.js').then(function() {
							return $ocLazyLoad.load('toaster');
						});
					}]
				}
			})
			.state('main.sys.user.update', {
				url: '/update/{id}?params',
				templateUrl: 'src/app/sys/user/update.html',
				controller: 'userUpdateController',
				resolve: {
					deps: ['uiLoad', '$ocLazyLoad', function(uiLoad, $ocLazyLoad) {
						return uiLoad.load('src/app/sys/user/updateController.js').then(function() {
							return $ocLazyLoad.load('toaster');
						});
					}]
				}
			})
			.state('main.sys.user.detail', {
				url: '/detail/{id}?params',
				templateUrl: 'src/app/sys/user/detail.html',
				controller: 'userDetailController',
				resolve: {
					deps: ['uiLoad', '$ocLazyLoad', function(uiLoad, $ocLazyLoad) {
						return uiLoad.load('src/app/sys/user/detailController.js').then(function() {
							return $ocLazyLoad.load('toaster');
						});
					}]
				}
			})
			//账号设置
			.state('main.sys.account', {
				url: '/account',
				template: '<div ui-view class="fade-in-right-big smooth"></div>'
			})
			.state('main.sys.account.update', {
				url: '/update',
				templateUrl: 'src/app/sys/account/accountUpdate.html',
				controller: 'accountUpdateController',
				resolve: {
					deps: ['uiLoad', '$ocLazyLoad', function(uiLoad, $ocLazyLoad) {
						return uiLoad.load('src/app/sys/account/accountUpdateController.js').then(function() {
							return $ocLazyLoad.load('toaster');
						});
					}]
				}
			})
			// 部门
			.state('main.sys.dept', {
				url: '/dept',
				template: '<div ui-view class="fade-in-right-big smooth"></div>'
			})
			.state('main.sys.dept.list', {
				url: '/list',
				templateUrl: 'src/app/sys/dept/dept.html',
				controller: 'deptController',
				resolve: {
					deps: ['uiLoad', '$ocLazyLoad', function(uiLoad, $ocLazyLoad) {
						return uiLoad.load('src/app/sys/dept/deptController.js').then(function() {
							return $ocLazyLoad.load('toaster');
						});
					}]
				}
			})
			.state('main.sys.dept.create', {
				url: '/create',
				templateUrl: 'src/app/sys/dept/update.html',
				controller: 'deptUpdateController',
				resolve: {
					deps: ['uiLoad', '$ocLazyLoad', function(uiLoad, $ocLazyLoad) {
						return uiLoad.load('src/app/sys/dept/updateController.js').then(function() {
							return $ocLazyLoad.load('toaster');
						});
					}]
				}
			})
			.state('main.sys.dept.update', {
				url: '/update/{id}?params',
				templateUrl: 'src/app/sys/dept/update.html',
				controller: 'deptUpdateController',
				resolve: {
					deps: ['uiLoad', '$ocLazyLoad', function(uiLoad, $ocLazyLoad) {
						return uiLoad.load('src/app/sys/dept/updateController.js').then(function() {
							return $ocLazyLoad.load('toaster');
						});
					}]
				}
			}) // 菜单
			.state('main.sys.menu', {
				url: '/menu',
				template: '<div ui-view class="fade-in-right-big smooth"></div>'
			})
			.state('main.sys.menu.list', {
				url: '/sysmenu/list',
				templateUrl: 'src/app/sys/menu/menu.html',
				controller: 'menuController',
				resolve: {
					deps: ['uiLoad', '$ocLazyLoad', function(uiLoad, $ocLazyLoad) {
						return uiLoad.load('src/app/sys/menu/menuController.js').then(function() {
							return $ocLazyLoad.load('toaster');
						});
					}]
				}
			})
			.state('main.sys.menu.details', {
				url: '/details/{id}?params',
				templateUrl: 'src/app/sys/menu/menuDetails.html',
				controller: 'menuDetailsController',
				resolve: {
					deps: ['uiLoad', '$ocLazyLoad', function(uiLoad, $ocLazyLoad) {
						return uiLoad.load('src/app/sys/menu/menuDetailsController.js').then(function() {
							return $ocLazyLoad.load('toaster');
						});
					}]
				}
			})
			.state('main.sys.menu.create', {
				url: '/sysmenu/create',
				templateUrl: 'src/app/sys/menu/update.html',
				controller: 'menuUpdateController',
				resolve: {
					deps: ['uiLoad', '$ocLazyLoad', function(uiLoad, $ocLazyLoad) {
						return uiLoad.load('src/app/sys/menu/updateController.js').then(function() {
							return $ocLazyLoad.load('toaster');
						});
					}]
				}
			})
			.state('main.sys.menu.update', {
				url: '/update/{id}?params',
				templateUrl: 'src/app/sys/menu/update.html',
				controller: 'menuUpdateController',
				resolve: {
					deps: ['uiLoad', '$ocLazyLoad', function(uiLoad, $ocLazyLoad) {
						return uiLoad.load('src/app/sys/menu/updateController.js').then(function() {
							return $ocLazyLoad.load('toaster');
						});
					}]
				}
			}) // 角色
			.state('main.sys.role', {
				url: '/role',
				template: '<div ui-view class="fade-in-right-big smooth"></div>'
			})
			.state('main.sys.role.list', {
				url: '/list',
				templateUrl: 'src/app/sys/role/role.html',
				controller: 'roleController',
				resolve: {
					deps: ['uiLoad', '$ocLazyLoad', function(uiLoad, $ocLazyLoad) {
						return uiLoad.load('src/app/sys/role/roleController.js').then(function() {
							return $ocLazyLoad.load('toaster');
						});
					}]
				}
			})
			.state('main.sys.role.create', {
				url: '/create',
				templateUrl: 'src/app/sys/role/update.html',
				controller: 'roleUpdateController',
				resolve: {
					deps: ['uiLoad', '$ocLazyLoad', function(uiLoad, $ocLazyLoad) {
						return uiLoad.load('src/app/sys/role/updateController.js').then(function() {
							return $ocLazyLoad.load('toaster');
						});
					}]
				}
			})
			.state('main.sys.role.update', {
				url: '/update/{id}?params',
				templateUrl: 'src/app/sys/role/update.html',
				controller: 'roleUpdateController',
				resolve: {
					deps: ['uiLoad', '$ocLazyLoad', function(uiLoad, $ocLazyLoad) {
						return uiLoad.load('src/app/sys/role/updateController.js').then(function() {
							return $ocLazyLoad.load('toaster');
						});
					}]
				}
			}) // 会话
			.state('main.sys.session', {
				url: '/session',
				template: '<div ui-view class="fade-in-right-big smooth"></div>'
			})
			.state('main.sys.session.list', {
				url: '/list',
				templateUrl: 'src/app/sys/session/session.html',
				controller: 'sessionController',
				resolve: {
					deps: ['uiLoad', '$ocLazyLoad', function(uiLoad, $ocLazyLoad) {
						return uiLoad.load('src/app/sys/session/sessionController.js').then(function() {
							return $ocLazyLoad.load('toaster');
						});
					}]
				}
			}) // 字典
			.state('main.sys.dic', {
				url: '/dic',
				template: '<div ui-view class="fade-in-right-big smooth"></div>'
			})
			.state('main.sys.dic.list', {
				url: '/list',
				templateUrl: 'src/app/sys/dic/dic.html',
				controller: 'dicController',
				resolve: {
					deps: ['uiLoad', '$ocLazyLoad', function(uiLoad, $ocLazyLoad) {
						return uiLoad.load('src/app/sys/dic/dicController.js').then(function() {
							return $ocLazyLoad.load('toaster');
						});
					}]
				}
			})
			.state('main.sys.dic.create', {
				url: '/create',
				templateUrl: 'src/app/sys/dic/update.html',
				controller: 'dicUpdateController',
				resolve: {
					deps: ['uiLoad', '$ocLazyLoad', function(uiLoad, $ocLazyLoad) {
						return uiLoad.load('src/app/sys/dic/updateController.js').then(function() {
							return $ocLazyLoad.load('toaster');
						});
					}]
				}
			})
			.state('main.sys.dic.update', {
				url: '/update/{id}?params',
				templateUrl: 'src/app/sys/dic/update.html',
				controller: 'dicUpdateController',
				resolve: {
					deps: ['uiLoad', '$ocLazyLoad', function(uiLoad, $ocLazyLoad) {
						return uiLoad.load('src/app/sys/dic/updateController.js').then(function() {
							return $ocLazyLoad.load('toaster');
						});
					}]
				}
			}) // 参数
			.state('main.sys.param', {
				url: '/param',
				template: '<div ui-view class="fade-in-right-big smooth"></div>'
			})
			.state('main.sys.param.list', {
				url: '/list',
				templateUrl: 'src/app/sys/param/param.html',
				controller: 'paramController',
				resolve: {
					deps: ['uiLoad', '$ocLazyLoad', function(uiLoad, $ocLazyLoad) {
						return uiLoad.load('src/app/sys/param/paramController.js').then(function() {
							return $ocLazyLoad.load('toaster');
						});
					}]
				}
			})
			.state('main.sys.param.create', {
				url: '/create',
				templateUrl: 'src/app/sys/param/update.html',
				controller: 'paramUpdateController',
				resolve: {
					deps: ['uiLoad', '$ocLazyLoad', function(uiLoad, $ocLazyLoad) {
						return uiLoad.load('src/app/sys/param/updateController.js').then(function() {
							return $ocLazyLoad.load('toaster');
						});
					}]
				}
			})
			.state('main.sys.param.update', {
				url: '/update/{id}?params',
				templateUrl: 'src/app/sys/param/update.html',
				controller: 'paramUpdateController',
				resolve: {
					deps: ['uiLoad', '$ocLazyLoad', function(uiLoad, $ocLazyLoad) {
						return uiLoad.load('src/app/sys/param/updateController.js').then(function() {
							return $ocLazyLoad.load('toaster');
						});
					}]
				}
			}) // 调度
			.state('main.task', {
				url: '/task',
				template: '<div ui-view class="fade-in-right-big smooth"></div>'
			})
			.state('main.task.scheduled', {
				url: '/scheduled',
				template: '<div ui-view class="fade-in-right-big smooth"></div>'
			})
			.state('main.task.scheduled.list', {
				url: '/list',
				templateUrl: 'src/app/task/scheduled/scheduled.html',
				controller: 'taskScheduledController',
				resolve: {
					deps: ['uiLoad', '$ocLazyLoad', function(uiLoad, $ocLazyLoad) {
						return uiLoad.load('src/app/task/scheduled/scheduledController.js').then(function() {
							return $ocLazyLoad.load('toaster');
						});
					}]
				}
			})
			.state('main.task.scheduled.create', {
				url: '/update',
				templateUrl: 'src/app/task/scheduled/update.html',
				controller: 'scheduledUpdateController',
				resolve: {
					deps: ['uiLoad', '$ocLazyLoad', function(uiLoad, $ocLazyLoad) {
						return uiLoad.load('src/app/task/scheduled/updateController.js').then(function() {
							return $ocLazyLoad.load('toaster');
						});
					}]
				}
			})
			.state('main.task.scheduled.update', {
				url: '/update',
				params: {
					'taskGroup': null,
					'taskName': null,
					'taskCron': null,
					'taskDesc': null,
					'taskType': null,
					'jobType': null,
					'targetObject': null,
					'targetMethod': null
				},
				templateUrl: 'src/app/task/scheduled/update.html',
				controller: 'scheduledUpdateController',
				resolve: {
					deps: ['uiLoad', '$ocLazyLoad', function(uiLoad, $ocLazyLoad) {
						return uiLoad.load('src/app/task/scheduled/updateController.js').then(function() {
							return $ocLazyLoad.load('toaster');
						});
					}]
				}
			})

			//人员管理
			.state('main.member', {
				url: '/member',
				template: '<div ui-view class="fade-in-right-big smooth"></div>'
			})
			.state('main.member.list', {
				url: '/list',
				templateUrl: 'src/app/bg/memInfo.html',
				controller: 'bgMemberController',
				resolve: {
					deps: ['uiLoad', '$ocLazyLoad', function(uiLoad, $ocLazyLoad) {
						return uiLoad.load('src/app/bg/memberController.js').then(function() {
							return $ocLazyLoad.load('toaster');
						});
					}]
				}
			})
			.state('main.member.create', {
				url: '/create',
				templateUrl: 'src/app/bg/updateMember.html',
				controller: 'memberUpdateController',
				resolve: {
					deps: ['uiLoad', '$ocLazyLoad', function(uiLoad, $ocLazyLoad) {
						return uiLoad.load('src/app/bg/updateMemberController.js').then(function() {
							return $ocLazyLoad.load('toaster');
						});
					}]
				}
			})
			.state('main.member.update', {
				url: '/update/{id}?params',
				templateUrl: 'src/app/bg/updateMember.html',
				controller: 'memberUpdateController',
				resolve: {
					deps: ['uiLoad', '$ocLazyLoad', function(uiLoad, $ocLazyLoad) {
						return uiLoad.load('src/app/bg/updateMemberController.js').then(function() {
							return $ocLazyLoad.load('toaster');
						});
					}]
				}
			})
			.state('main.member.details', {
				url: '/details/{id}?params',
				templateUrl: 'src/app/bg/detailsMember.html',
				controller: 'memberDetailsController',
				resolve: {
					deps: ['uiLoad', '$ocLazyLoad', function(uiLoad, $ocLazyLoad) {
						return uiLoad.load('src/app/bg/detailsMemberController.js').then(function() {
							return $ocLazyLoad.load('toaster');
						});
					}]
				}
			})

			//人员房屋关系
			.state('main.member.personHouse', {
				url: '/member',
				template: '<div ui-view class="fade-in-right-big smooth"></div>'
			})
			.state('main.member.personHouse.list', {
				url: '/list',
				templateUrl: 'src/app/bg/personHouse.html',
				controller: 'memberPersonHouseController',
				resolve: {
					deps: ['uiLoad', '$ocLazyLoad', function(uiLoad, $ocLazyLoad) {
						return uiLoad.load('src/app/bg/personHouseController.js').then(function() {
							return $ocLazyLoad.load('toaster');
						});
					}]
				}
			})
			.state('main.member.personHouse.create', {
				url: '/create',
				templateUrl: 'src/app/bg/personHouseUpdate.html',
				controller: 'updatePersonHouseController',
				resolve: {
					deps: ['uiLoad', '$ocLazyLoad', function(uiLoad, $ocLazyLoad) {
						return uiLoad.load('src/app/bg/personHouseUpdateController.js').then(function() {
							return $ocLazyLoad.load('toaster');
						});
					}]
				}
			})
			.state('main.member.personHouse.update', {
				url: '/update/{id}?params',
				templateUrl: 'src/app/bg/personHouseUpdate.html',
				controller: 'updatePersonHouseController',
				resolve: {
					deps: ['uiLoad', '$ocLazyLoad', function(uiLoad, $ocLazyLoad) {
						return uiLoad.load('src/app/bg/personHouseUpdateController.js').then(function() {
							return $ocLazyLoad.load('toaster');
						});
					}]
				}
			})
			// 维修人员列表
			.state('main.member.maintenance', {
				url: '/maintenance',
				template: '<div ui-view class="fade-in-right-big smooth"></div>'
			})
			.state('main.member.maintenance.list', {
				url: '/list/{groupCode}?params',
				templateUrl: 'src/app/bg/maintenance.html',
				controller: 'maintenanceController',
				resolve: {
					deps: ['uiLoad', '$ocLazyLoad', function(uiLoad, $ocLazyLoad) {
						return uiLoad.load('src/app/bg/maintenanceController.js').then(function() {
							return $ocLazyLoad.load('toaster');
						});
					}]
				}
			})
			//维修人员组
			.state('main.member.maintenance.group', {
				url: '/group',
				templateUrl: 'src/app/bg/maintenanceGroup.html',
				controller: 'maintenanceGroupController',
				resolve: {
					deps: ['uiLoad', '$ocLazyLoad', function(uiLoad, $ocLazyLoad) {
						return uiLoad.load('src/app/bg/maintenanceGroupController.js').then(function() {
							return $ocLazyLoad.load('toaster');
						});
					}]
				}
			})
			//维修人员组新增
			.state('main.member.maintenance.groupUpdate', {
				url: '/groupUpdate/{groupCode}?params',
				templateUrl: 'src/app/bg/maintenanceGroupUpdate.html',
				controller: 'maintenanceGroupUpdateController',
				resolve: {
					deps: ['uiLoad', '$ocLazyLoad', function(uiLoad, $ocLazyLoad) {
						return uiLoad.load('src/app/bg/maintenanceGroupUpdateController.js').then(function() {
							return $ocLazyLoad.load('toaster');
						});
					}]
				}
			})
			//维修人员组编辑
			.state('main.member.maintenance.groupCreate', {
				url: '/groupCreate',
				templateUrl: 'src/app/bg/maintenanceGroupUpdate.html',
				controller: 'maintenanceGroupUpdateController',
				resolve: {
					deps: ['uiLoad', '$ocLazyLoad', function(uiLoad, $ocLazyLoad) {
						return uiLoad.load('src/app/bg/maintenanceGroupUpdateController.js').then(function() {
							return $ocLazyLoad.load('toaster');
						});
					}]
				}
			})
			//维修人员新增
			.state('main.member.maintenance.create', {
				url: '/update/{groupCode}?params',
				templateUrl: 'src/app/bg/maintenanceUpdate.html',
				controller: 'maintenanceUpdateController',
				resolve: {
					deps: ['uiLoad', '$ocLazyLoad', function(uiLoad, $ocLazyLoad) {
						return uiLoad.load('src/app/bg/maintenanceUpdateController.js').then(function() {
							return $ocLazyLoad.load('toaster');
						});
					}]
				}
			})
			//开门记录
			/*.state('main.member.openDoorlist', {
			    url: '/openDoorlist',
			    templateUrl: 'src/app/bg/openDoorHistory.html',
			    controller: 'bgOpenDoorController',
			    resolve: {
			        deps: ['uiLoad', '$ocLazyLoad', function(uiLoad, $ocLazyLoad) {
			            return uiLoad.load('src/app/bg/openDoorController.js').then(function() {
			                return $ocLazyLoad.load('toaster');
			            });
			        }]
			      }
			})*/
			.state('main.member.openDoor', {
				url: '/openDoor',
				template: '<div ui-view class="fade-in-right-big smooth"></div>'
			})
			.state('main.member.openDoor.list', {
				url: '/list',
				templateUrl: 'src/app/bg/openDoorHistory.html',
				controller: 'bgOpenDoorController',
				resolve: {
					deps: ['uiLoad', '$ocLazyLoad', function(uiLoad, $ocLazyLoad) {
						return uiLoad.load('src/app/bg/openDoorController.js').then(function() {
							return $ocLazyLoad.load('toaster');
						});
					}]
				}
			})
			.state('main.member.openDoor.update', {
				url: '/openDoor/update/{id}?params',
				templateUrl: 'src/app/bg/updateOpenDoor.html',
				controller: 'doorUpdateController',
				resolve: {
					deps: ['uiLoad', '$ocLazyLoad', function(uiLoad, $ocLazyLoad) {
						return uiLoad.load('src/app/bg/updateDoorRecordController.js').then(function() {
							return $ocLazyLoad.load('toaster');
						});
					}]
				}
			})

			.state('main.task.log', {
				url: '/log',
				template: '<div ui-view class="fade-in-right-big smooth"></div>'
			})
			.state('main.task.log.list', {
				url: '/list',
				templateUrl: 'src/app/task/scheduled/log.html',
				controller: 'scheduledLogController',
				resolve: {
					deps: ['uiLoad', '$ocLazyLoad', function(uiLoad, $ocLazyLoad) {
						return uiLoad.load('src/app/task/scheduled/logController.js').then(function() {
							return $ocLazyLoad.load('toaster');
						});
					}]
				}
			})
			.state('main.doorSysManager', {
				url: '/doorSysManager',
				template: '<div ui-view class="fade-in-right-big smooth"></div>'
			})
			.state('main.doorSysManager.authManager', {
				url: '/authManager',
				template: '<div ui-view class="fade-in-right-big smooth"></div>'
			})
			.state('main.doorSysManager.authManager.list', {
				url: '/list',
				templateUrl: 'src/app/doorSysManger/authManager/authManager.html',
				controller: 'dmAuthManagerController',
				resolve: {
					deps: ['uiLoad', '$ocLazyLoad', function(uiLoad, $ocLazyLoad) {
						return uiLoad.load('src/app/doorSysManger/authManager/authManagerController.js').then(function() {
							return $ocLazyLoad.load('toaster');
						});
					}]
				}
			})
			.state('main.doorSysManager.authManager.create', {
				url: '/create',
				templateUrl: 'src/app/doorSysManger/authManager/update.html',
				controller: 'dmAuthUpdateController',
				resolve: {
					deps: ['uiLoad', '$ocLazyLoad', function(uiLoad, $ocLazyLoad) {
						return uiLoad.load('src/app/doorSysManger/authManager/updateController.js').then(function() {
							return $ocLazyLoad.load('toaster');
						});
					}]
				}
			})
			.state('main.doorSysManager.authManager.update', {
				url: '/update/{id}?params',
				templateUrl: 'src/app/doorSysManger/authManager/update.html',
				controller: 'dmAuthUpdateController',
				resolve: {
					deps: ['uiLoad', '$ocLazyLoad', function(uiLoad, $ocLazyLoad) {
						return uiLoad.load('src/app/doorSysManger/authManager/updateController.js').then(function() {
							return $ocLazyLoad.load('toaster');
						});
					}]
				}
			})
			.state('main.authm', {
				url: '/authm',
				template: '<div ui-view class="fade-in-right-big smooth"></div>'
			})
			.state('main.authm.cardAuth', {
				url: '/cardAuth',
				template: '<div ui-view class="fade-in-right-big smooth"></div>'
			})
			.state('main.authm.cardAuth.list', {
				url: '/list',
				templateUrl: 'src/app/authm/card/authManager.html',
				controller: 'authManagerController',
				resolve: {
					deps: ['uiLoad', '$ocLazyLoad', function(uiLoad, $ocLazyLoad) {
						return uiLoad.load('src/app/authm/card/authManagerController.js').then(function() {
							return $ocLazyLoad.load('toaster');
						});
					}]
				}
			})
			.state('main.authm.cardAuth.create', {
				url: '/create',
				templateUrl: 'src/app/authm/card/create.html',
				controller: 'authCreateController',
				resolve: {
					deps: ['uiLoad', '$ocLazyLoad', function(uiLoad, $ocLazyLoad) {
						return uiLoad.load('src/app/authm/card/createController.js').then(function() {
							return $ocLazyLoad.load('toaster');
						});
					}]
				}
			})

			.state('main.authm.cardAuth.update', {
				url: '/update/{id}/{authorType}?params',
				templateUrl: 'src/app/authm/card/create.html',
				controller: 'authCreateController',
				resolve: {
					deps: ['uiLoad', '$ocLazyLoad', function(uiLoad, $ocLazyLoad) {
						return uiLoad.load('src/app/authm/card/createController.js').then(function() {
							return $ocLazyLoad.load('toaster');
						});
					}]
				}
			})
			.state('main.authm.cardAuth.quickAuth', {
				url: '/quickAuth',
				templateUrl: 'src/app/authm/card/quickAuth.html',
				controller: 'quickAuthController',
				resolve: {
					deps: ['uiLoad', '$ocLazyLoad', function(uiLoad, $ocLazyLoad) {
						return uiLoad.load('src/app/authm/card/quickAuthController.js').then(function() {
							return $ocLazyLoad.load('toaster');
						});
					}]
				}
			})

			.state('main.authm.rapidAuthorization', {
				url: '/rapidAuthorization',
				template: '<div ui-view class="fade-in-right-big smooth"></div>'
			})
			.state('main.authm.rapidAuthorization.create', {
				url: '/create',
				templateUrl: 'src/app/authm/card/authorizationCreate.html',
				controller: 'rapidAuthController',
				resolve: {
					deps: ['uiLoad', '$ocLazyLoad', function(uiLoad, $ocLazyLoad) {
						return uiLoad.load('src/app/authm/card/authorizationCreate.js').then(function() {
							return $ocLazyLoad.load('toaster');
						});
					}]
				}
			})

			.state('main.authm.group', {
				url: '/group',
				template: '<div ui-view class="fade-in-right-big smooth"></div>'
			})
			.state('main.authm.group.list', {
				url: '/list',
				templateUrl: 'src/app/authm/group/group.html',
				controller: 'authGroupController',
				resolve: {
					deps: ['uiLoad', '$ocLazyLoad', function(uiLoad, $ocLazyLoad) {
						return uiLoad.load('src/app/authm/group/groupController.js').then(function() {
							return $ocLazyLoad.load('toaster');
						});
					}]
				}
			})
			.state('main.authm.group.create', {
				url: '/create',
				templateUrl: 'src/app/authm/group/update.html',
				controller: 'authGroupUpdateController',
				resolve: {
					deps: ['uiLoad', '$ocLazyLoad', function(uiLoad, $ocLazyLoad) {
						return uiLoad.load('src/app/authm/group/updateController.js').then(function() {
							return $ocLazyLoad.load('toaster');
						});
					}]
				}
			})
			.state('main.authm.group.update', {
				url: '/update/{id}?params',
				templateUrl: 'src/app/authm/group/update.html',
				controller: 'authGroupUpdateController',
				resolve: {
					deps: ['uiLoad', '$ocLazyLoad', function(uiLoad, $ocLazyLoad) {
						return uiLoad.load('src/app/authm/group/updateController.js').then(function() {
							return $ocLazyLoad.load('toaster');
						});
					}]
				}
			})

			.state('main.authm.cardAuth.inAndOutlist', {
				url: '/inAndOutManager',
				templateUrl: 'src/app/authm/card/inAndOutManager.html',
				controller: 'inAndOutManagerController',
				resolve: {
					deps: ['uiLoad', '$ocLazyLoad', function(uiLoad, $ocLazyLoad) {
						return uiLoad.load('src/app/authm/card/inAndOutManagerController.js').then(function() {
							return $ocLazyLoad.load('toaster');
						});
					}]
				}
			})
			.state('main.authm.cardAuth.details', {
				url: '/details/{id}/{inOutType}/{date}?params',
				templateUrl: 'src/app/authm/card/detailsInAndOut.html',
				controller: 'detailsInAndOutController',
				resolve: {
					deps: ['uiLoad', '$ocLazyLoad', function(uiLoad, $ocLazyLoad) {
						return uiLoad.load('src/app/authm/card/detailsInAndOutController.js').then(function() {
							return $ocLazyLoad.load('toaster');
						});
					}]
				}
			})
			.state('main.authm.cardAuth.cardRecordlist', {
				url: '/cardRecordlist',
				templateUrl: 'src/app/authm/card/cardRecord.html',
				controller: 'cardRecordController',
				resolve: {
					deps: ['uiLoad', '$ocLazyLoad', function(uiLoad, $ocLazyLoad) {
						return uiLoad.load('src/app/authm/card/cardRecordController.js').then(function() {
							return $ocLazyLoad.load('toaster');
						});
					}]
				}
			})

			.state('main.authm.cardAuth.cardExpireSoonlist', {
				url: '/cardExpireSoonlist',
				templateUrl: 'src/app/authm/card/cardExpireSoon.html',
				controller: 'cardExpireSoonController',
				resolve: {
					deps: ['uiLoad', '$ocLazyLoad', function(uiLoad, $ocLazyLoad) {
						return uiLoad.load('src/app/authm/card/cardExpireSoonController.js').then(function() {
							return $ocLazyLoad.load('toaster');
						});
					}]
				}
			})
			.state('main.bm', {
				url: '/dac/bm',
				template: '<div ui-view class="fade-in-right-big smooth"></div>'
			})
			.state('main.bm.house', {
				url: '/house',
				template: '<div ui-view class="fade-in-right-big smooth"></div>'
			})
			.state('main.bm.house.list', {
				params: {
					'regionId': null,
					'regionName': null
				},
				url: '/list',
				templateUrl: 'src/app/bm/house/house.html',
				controller: 'bmHouseController',
				resolve: {
					deps: ['uiLoad', '$ocLazyLoad', function(uiLoad, $ocLazyLoad) {
						return uiLoad.load('src/app/bm/house/houseController.js').then(function() {
							return $ocLazyLoad.load('toaster');
						});
					}]
				}
			})
			.state('main.bm.house.create', {
				url: '/create/{regionId}/{regionName}?params',
				templateUrl: 'src/app/bm/house/update.html',
				controller: 'bmHouseUpdateController',
				resolve: {
					deps: ['uiLoad', '$ocLazyLoad', function(uiLoad, $ocLazyLoad) {
						return uiLoad.load('src/app/bm/house/updateController.js').then(function() {
							return $ocLazyLoad.load('toaster');
						});
					}]
				}
			})
			.state('main.bm.house.update', {
				url: '/update/{id}?params',
				templateUrl: 'src/app/bm/house/update.html',
				controller: 'bmHouseUpdateController',
				resolve: {
					deps: ['uiLoad', '$ocLazyLoad', function(uiLoad, $ocLazyLoad) {
						return uiLoad.load('src/app/bm/house/updateController.js').then(function() {
							return $ocLazyLoad.load('toaster');
						});
					}]
				}
			}).state('main.bm.building', {
				url: '/building',
				template: '<div ui-view class="fade-in-right-big smooth"></div>'
			})
			.state('main.bm.building.list', {
				params: {
					'regionId': null,
					'regionName': null
				},
				url: '/list',
				templateUrl: 'src/app/bm/building/building.html',
				controller: 'bmBuildingController',
				resolve: {
					deps: ['uiLoad', '$ocLazyLoad', function(uiLoad, $ocLazyLoad) {
						return uiLoad.load('src/app/bm/building/buildingController.js').then(function() {
							return $ocLazyLoad.load('toaster');
						});
					}]
				}
			})
			.state('main.bm.building.create', {
				url: '/create/{regionId}/{regionName}?params',
				templateUrl: 'src/app/bm/building/update.html',
				controller: 'bmBuildingUpdateController',
				resolve: {
					deps: ['uiLoad', '$ocLazyLoad', function(uiLoad, $ocLazyLoad) {
						return uiLoad.load('src/app/bm/building/updateController.js').then(function() {
							return $ocLazyLoad.load('toaster');
						});
					}]
				}
			})
			.state('main.bm.building.update', {
				url: '/update/{id}?params',
				templateUrl: 'src/app/bm/building/update.html',
				controller: 'bmBuildingUpdateController',
				resolve: {
					deps: ['uiLoad', '$ocLazyLoad', function(uiLoad, $ocLazyLoad) {
						return uiLoad.load('src/app/bm/building/updateController.js').then(function() {
							return $ocLazyLoad.load('toaster');
						});
					}]
				}
			}).state('main.bm.seat', {
				url: '/seat',
				template: '<div ui-view class="fade-in-right-big smooth"></div>'
			})
			.state('main.bm.seat.list', {
				params: {
					'regionId': null,
					'regionName': null
				},
				url: '/list',
				templateUrl: 'src/app/bm/seat/seat.html',
				controller: 'bmSeatController',
				resolve: {
					deps: ['uiLoad', '$ocLazyLoad', function(uiLoad, $ocLazyLoad) {
						return uiLoad.load('src/app/bm/seat/seatController.js').then(function() {
							return $ocLazyLoad.load('toaster');
						});
					}]
				}
			})
			.state('main.bm.seat.create', {
				url: '/create/{regionId}/{regionName}?params',
				templateUrl: 'src/app/bm/seat/update.html',
				controller: 'bmSeatUpdateController',
				resolve: {
					deps: ['uiLoad', '$ocLazyLoad', function(uiLoad, $ocLazyLoad) {
						return uiLoad.load('src/app/bm/seat/updateController.js').then(function() {
							return $ocLazyLoad.load('toaster');
						});
					}]
				}
			})
			.state('main.bm.seat.update', {
				url: '/update/{id}?params',
				templateUrl: 'src/app/bm/seat/update.html',
				controller: 'bmSeatUpdateController',
				resolve: {
					deps: ['uiLoad', '$ocLazyLoad', function(uiLoad, $ocLazyLoad) {
						return uiLoad.load('src/app/bm/seat/updateController.js').then(function() {
							return $ocLazyLoad.load('toaster');
						});
					}]
				}
			}).state('main.bm.floor', {
				url: '/floor',
				template: '<div ui-view class="fade-in-right-big smooth"></div>'
			})
			.state('main.bm.floor.list', {
				params: {
					'regionId': null,
					'regionName': null
				},
				url: '/list',
				templateUrl: 'src/app/bm/floor/floor.html',
				controller: 'bmFloorController',
				resolve: {
					deps: ['uiLoad', '$ocLazyLoad', function(uiLoad, $ocLazyLoad) {
						return uiLoad.load('src/app/bm/floor/floorController.js').then(function() {
							return $ocLazyLoad.load('toaster');
						});
					}]
				}
			})
			.state('main.bm.floor.create', {
				url: '/create/{regionId}/{regionName}?params',
				templateUrl: 'src/app/bm/floor/update.html',
				controller: 'bmFloorUpdateController',
				resolve: {
					deps: ['uiLoad', '$ocLazyLoad', function(uiLoad, $ocLazyLoad) {
						return uiLoad.load('src/app/bm/floor/updateController.js').then(function() {
							return $ocLazyLoad.load('toaster');
						});
					}]
				}
			})
			.state('main.bm.floor.update', {
				url: '/update/{id}?params',
				templateUrl: 'src/app/bm/floor/update.html',
				controller: 'bmFloorUpdateController',
				resolve: {
					deps: ['uiLoad', '$ocLazyLoad', function(uiLoad, $ocLazyLoad) {
						return uiLoad.load('src/app/bm/floor/updateController.js').then(function() {
							return $ocLazyLoad.load('toaster');
						});
					}]
				}
			})
			.state('main.regionManage', {
				url: '/region',
				template: '<div ui-view class="fade-in-right-big smooth"></div>'
			})
			.state('main.regionManage.region', {
				url: '/region',
				template: '<div ui-view class="fade-in-right-big smooth"></div>'
			})
			.state('main.regionManage.region.tree', {
				url: '/tree',
				templateUrl: 'src/app/bm/region.html',
				controller: 'rmRiRegionController',
				resolve: {
					deps: ['uiLoad', '$ocLazyLoad', function(uiLoad, $ocLazyLoad) {
						return uiLoad.load('src/app/bm/regionController.js').then(function() {
							return $ocLazyLoad.load('toaster');
						});
					}]
				}
			})
			.state('main.dm', {
				url: '/dac/dm',
				template: '<div ui-view class="fade-in-right-big smooth"></div>'
			})

			.state('main.dm.trajectory', {
				url: '/trajectory',
				template: '<div ui-view class="fade-in-right-big smooth"></div>'
			})

			.state('main.dm.trajectory.list', {
				url: '/list',
				templateUrl: 'src/app/dm/trajectory/trajectory.html',
				controller: 'trajectoryController',
				resolve: {
					deps: ['uiLoad', '$ocLazyLoad', function(uiLoad, $ocLazyLoad) {
						return uiLoad.load('src/app/dm/trajectory/trajectoryController.js').then(function() {
							return $ocLazyLoad.load('toaster');
						});
					}]
				}
			})
			.state('main.dm.trajectory.performance', {
				url: '/performance',
				templateUrl: 'src/app/dm/trajectory/performance.html',
				controller: 'performanceController',
				resolve: {
					deps: ['uiLoad', '$ocLazyLoad', function(uiLoad, $ocLazyLoad) {
						return uiLoad.load('src/app/dm/trajectory/performanceController.js').then(function() {
							return $ocLazyLoad.load('toaster');
						});
					}]
				}
			})

			.state('main.dm.dmManager', {
				url: '/dmManager',
				template: '<div ui-view class="fade-in-right-big smooth"></div>'
			})
			.state('main.dm.dmManager.list', {
				url: '/list',
				templateUrl: 'src/app/dm/device/dmManager.html',
				controller: 'dmManagerController',
				resolve: {
					deps: ['uiLoad', '$ocLazyLoad', function(uiLoad, $ocLazyLoad) {
						return uiLoad.load('src/app/dm/device/dmManagerController.js').then(function() {
							return $ocLazyLoad.load('toaster');
						});
					}]
				}
			})
			.state('main.dm.dmManager.create', {
				url: '/create',
				templateUrl: 'src/app/dm/device/update.html',
				controller: 'createDeviceController',
				resolve: {
					deps: ['uiLoad', '$ocLazyLoad', function(uiLoad, $ocLazyLoad) {
						return uiLoad.load('src/app/dm/device/updateController.js').then(function() {
							return $ocLazyLoad.load('toaster');
						});
					}]
				}
			})
			.state('main.dm.dmManager.update', {
				url: '/update/{id}?params',
				templateUrl: 'src/app/dm/device/update.html',
				controller: 'createDeviceController',
				resolve: {
					deps: ['uiLoad', '$ocLazyLoad', function(uiLoad, $ocLazyLoad) {
						return uiLoad.load('src/app/dm/device/updateController.js').then(function() {
							return $ocLazyLoad.load('toaster');
						});
					}]
				}
			})
			.state('main.dm.dmManager.details', {
				url: '/details/{id}{onlineStatus}?params',
				templateUrl: 'src/app/dm/device/deviceDetails.html',
				controller: 'deviceDetailController',
				resolve: {
					deps: ['uiLoad', '$ocLazyLoad', function(uiLoad, $ocLazyLoad) {
						return uiLoad.load('src/app/dm/device/deviceDetailsController.js').then(function() {
							return $ocLazyLoad.load('toaster');
						});
					}]
				}
			})
			.state('main.dm.ability', {
				url: '/ability',
				template: '<div ui-view class="fade-in-right-big smooth"></div>'
			})
			.state('main.dm.ability.list', {
				url: '/list',
				templateUrl: 'src/app/dm/ability/ability.html',
				controller: 'abilityController',
				resolve: {
					deps: ['uiLoad', '$ocLazyLoad', function(uiLoad, $ocLazyLoad) {
						return uiLoad.load('src/app/dm/ability/abilityController.js').then(function() {
							return $ocLazyLoad.load('toaster');
						});
					}]
				}
			})
			.state('main.dm.ability.create', {
				url: '/create',
				templateUrl: 'src/app/dm/ability/update.html',
				controller: 'createAbilityController',
				resolve: {
					deps: ['uiLoad', '$ocLazyLoad', function(uiLoad, $ocLazyLoad) {
						return uiLoad.load('src/app/dm/ability/updateController.js').then(function() {
							return $ocLazyLoad.load('toaster');
						});
					}]
				}
			})
			.state('main.dm.ability.update', {
				url: '/update/{id}?params',
				templateUrl: 'src/app/dm/ability/update.html',
				controller: 'createAbilityController',
				resolve: {
					deps: ['uiLoad', '$ocLazyLoad', function(uiLoad, $ocLazyLoad) {
						return uiLoad.load('src/app/dm/ability/updateController.js').then(function() {
							return $ocLazyLoad.load('toaster');
						});
					}]
				}
			})
			.state('main.dm.category', {
				url: '/category',
				template: '<div ui-view class="fade-in-right-big smooth"></div>'
			})
			.state('main.dm.category.list', {
				url: '/list',
				templateUrl: 'src/app/dm/category/category.html',
				controller: 'categoryController',
				resolve: {
					deps: ['uiLoad', '$ocLazyLoad', function(uiLoad, $ocLazyLoad) {
						return uiLoad.load('src/app/dm/category/categoryController.js').then(function() {
							return $ocLazyLoad.load('toaster');
						});
					}]
				}
			})
			.state('main.dm.category.create', {
				url: '/create',
				templateUrl: 'src/app/dm/category/update.html',
				controller: 'createCategoryController',
				resolve: {
					deps: ['uiLoad', '$ocLazyLoad', function(uiLoad, $ocLazyLoad) {
						return uiLoad.load('src/app/dm/category/updateController.js').then(function() {
							return $ocLazyLoad.load('toaster');
						});
					}]
				}
			})
			.state('main.dm.category.update', {
				url: '/update/{id}?params',
				templateUrl: 'src/app/dm/category/update.html',
				controller: 'createCategoryController',
				resolve: {
					deps: ['uiLoad', '$ocLazyLoad', function(uiLoad, $ocLazyLoad) {
						return uiLoad.load('src/app/dm/category/updateController.js').then(function() {
							return $ocLazyLoad.load('toaster');
						});
					}]
				}
			})
			.state('main.dm.warn', {
				url: '/warn',
				template: '<div ui-view class="fade-in-right-big smooth"></div>'
			})
			.state('main.dm.warn.list', {
				url: '/list',
				templateUrl: 'src/app/dm/warn/warn.html',
				controller: 'warnController',
				resolve: {
					deps: ['uiLoad', '$ocLazyLoad', function(uiLoad, $ocLazyLoad) {
						return uiLoad.load('src/app/dm/warn/warnController.js').then(function() {
							return $ocLazyLoad.load('toaster');
						});
					}]
				}
			})
			.state('main.dm.warn.details', {
				url: '/details/{id}?params',
				templateUrl: 'src/app/dm/warn/warnDetails.html',
				controller: 'warnDetailsController',
				resolve: {
					deps: ['uiLoad', '$ocLazyLoad', function(uiLoad, $ocLazyLoad) {
						return uiLoad.load('src/app/dm/warn/warnDetailsController.js').then(function() {
							return $ocLazyLoad.load('toaster');
						});
					}]
				}
			})
			.state('main.dm.map', {
				url: '/map',
				templateUrl: 'src/app/dm/map/mapManager.html',
				controller: 'mapManagerController',
				resolve: {
					deps: ['uiLoad', '$ocLazyLoad', function(uiLoad, $ocLazyLoad) {
						return uiLoad.load('src/app/dm/map/mapManagerController.js').then(function() {
							return $ocLazyLoad.load('toaster');
						});
					}]
				}
			})

			//实时监控
			// .state('main.dm.realTimeMoniTo', {
			//     url: '/realTimeMoniTo',
			//     template: '<div ui-view class="fade-in-right-big smooth"></div>'
			// })
			.state('main.dm.realTimeMoniTo', {
				url: '/realTimeMoniTo',
				templateUrl: 'src/app/dm/realTimeMoniTo/realTimeMoniTo.html',
				controller: 'realTimeMoniToController',
				resolve: {
					deps: ['uiLoad', '$ocLazyLoad', function(uiLoad, $ocLazyLoad) {
						return uiLoad.load('src/app/dm/realTimeMoniTo/realTimeMoniToController.js').then(function() {
							return $ocLazyLoad.load('toaster');
						});
					}]
				}
			})

			.state('main.regionManage.region.list', {
				url: '/list',
				templateUrl: 'src/app/bm/region/regionlist.html',
				controller: 'regionlistController',
				resolve: {
					deps: ['uiLoad', '$ocLazyLoad', function(uiLoad, $ocLazyLoad) {
						return uiLoad.load('src/app/bm/region/regionlistController.js').then(function() {
							return $ocLazyLoad.load('toaster');
						});
					}]
				}
			})
			.state('main.regionManage.region.create', {
				url: '/create',
				templateUrl: 'src/app/bm/region/update.html',
				controller: 'regionupdateController',
				resolve: {
					deps: ['uiLoad', '$ocLazyLoad', function(uiLoad, $ocLazyLoad) {
						return uiLoad.load('src/app/bm/region/updateController.js').then(function() {
							return $ocLazyLoad.load('toaster');
						});
					}]
				}
			})
			.state('main.regionManage.region.update', {
				url: '/update/{id}?params',
				templateUrl: 'src/app/bm/region/update.html',
				controller: 'regionupdateController',
				resolve: {
					deps: ['uiLoad', '$ocLazyLoad', function(uiLoad, $ocLazyLoad) {
						return uiLoad.load('src/app/bm/region/updateController.js').then(function() {
							return $ocLazyLoad.load('toaster');
						});
					}]
				}
			})
			.state('main.sys.clientm', {
				url: '/clientm',
				template: '<div ui-view class="fade-in-right-big smooth"></div>'
			})
			.state('main.sys.clientm.list', {
				url: '/list',
				templateUrl: 'src/app/client/clientManager.html',
				controller: 'clientManagerController',
				resolve: {
					deps: ['uiLoad', '$ocLazyLoad', function(uiLoad, $ocLazyLoad) {
						return uiLoad.load('src/app/client/clientManagerController.js').then(function() {
							return $ocLazyLoad.load('toaster');
						});
					}]
				}
			})
			.state('main.sys.clientm.create', {
				url: '/create',
				templateUrl: 'src/app/client/update.html',
				controller: 'clientUpdateController',
				resolve: {
					deps: ['uiLoad', '$ocLazyLoad', function(uiLoad, $ocLazyLoad) {
						return uiLoad.load('src/app/client/updateController.js').then(function() {
							return $ocLazyLoad.load('toaster');
						});
					}]
				}
			})
			.state('main.sys.clientm.update', {
				url: '/update/{id}?params',
				templateUrl: 'src/app/client/update.html',
				controller: 'clientUpdateController',
				resolve: {
					deps: ['uiLoad', '$ocLazyLoad', function(uiLoad, $ocLazyLoad) {
						return uiLoad.load('src/app/client/updateController.js').then(function() {
							return $ocLazyLoad.load('toaster');
						});
					}]
				}
			})
			//下载管理
			.state('main.download', {
				url: '/download',
				template: '<div ui-view class="fade-in-right-big smooth"></div>'
			})
			.state('main.download.house', {
				url: '/downloadHouse',
				templateUrl: 'src/app/download/downloadHouse.html',
				controller: 'downloadHouseController',
				resolve: {
					deps: ['uiLoad', '$ocLazyLoad', function(uiLoad, $ocLazyLoad) {
						return uiLoad.load('src/app/download/downloadHouseController.js').then(function() {
							return $ocLazyLoad.load('toaster');
						});
					}]
				}
			})
            .state('main.download.authimportlog', {
                url: '/authimportlog',
                templateUrl: 'src/app/download/authImportLog.html',
                controller: 'authImportController',
                resolve: {
                    deps: ['uiLoad', '$ocLazyLoad', function(uiLoad, $ocLazyLoad) {
                        return uiLoad.load('src/app/download/authImportLogController.js').then(function() {
                            return $ocLazyLoad.load('toaster');
                        });
                    }]
                }
            })
            .state('main.download.details', {
                url: '/details/{id}?params',
                templateUrl: 'src/app/download/authImportLogDetail.html',
                controller: 'authImportLogDetailsController',
                resolve: {
                    deps: ['uiLoad', '$ocLazyLoad', function(uiLoad, $ocLazyLoad) {
                        return uiLoad.load('src/app/download/authImportLogDetailController.js').then(function() {
                            return $ocLazyLoad.load('toaster');
                        });
                    }]
                }
            })
            .state('main.download.export', {
                url: '/export',
                templateUrl: 'src/app/download/exportData.html',
                controller: 'exportDataController',
                resolve: {
                    deps: ['uiLoad', '$ocLazyLoad', function(uiLoad, $ocLazyLoad) {
                        return uiLoad.load('src/app/download/exportController.js').then(function() {
                            return $ocLazyLoad.load('toaster');
                        });
                    }]
                }
            })

			//统计报表
			.state('main.report', {
				url: '/report',
				template: '<div ui-view class="fade-in-right-big smooth"></div>'
			})
			.state('main.report.person', {
				url: '/person/list',
				templateUrl: 'src/app/report/report.html',
				controller: 'reportController',
				resolve: {
					deps: ['uiLoad', '$ocLazyLoad', function(uiLoad, $ocLazyLoad) {
						return uiLoad.load('src/app/report/reportController.js').then(function() {
							return $ocLazyLoad.load('toaster');
						});
					}]
				}
			})
			.state('main.report.authostatis', {
				url: '/authostatis/list',
				templateUrl: 'src/app/report/authostatisReport.html',
				controller: 'authostatisController',
				resolve: {
					deps: ['uiLoad', '$ocLazyLoad', function(uiLoad, $ocLazyLoad) {
						return uiLoad.load('src/app/report/authostatisController.js').then(function() {
							return $ocLazyLoad.load('toaster');
						});
					}]
				}
			})
			.state('main.report.accessstatis', {
				url: '/accessstatis/list',
				templateUrl: 'src/app/report/accessStatis.html',
				controller: 'accessStatisController',
				resolve: {
					deps: ['uiLoad', '$ocLazyLoad', function(uiLoad, $ocLazyLoad) {
						return uiLoad.load('src/app/report/accessStatisController.js').then(function() {
							return $ocLazyLoad.load('toaster');
						});
					}]
				}
			})

			.state('main.dm.DmMaintain', {
				url: '/DmMaintain',
				template: '<div ui-view class="fade-in-right-big smooth"></div>'
			})
			.state('main.dm.DmMaintain.list', {
				url: '/DmMaintain/list',
				templateUrl: 'src/app/dm/maintain/maintain.html',
				controller: 'maintainController',
				resolve: {
					deps: ['uiLoad', '$ocLazyLoad', function(uiLoad, $ocLazyLoad) {
						return uiLoad.load('src/app/dm/maintain/maintainController.js').then(function() {
							return $ocLazyLoad.load('toaster');
						});
					}]
				}
			})
			.state('main.dm.DmMaintain.create', {
				url: '/DmMaintain/create',
				templateUrl: 'src/app/dm/maintain/maintainCreate.html',
				controller: 'maintainCreateController',
				resolve: {
					deps: ['uiLoad', '$ocLazyLoad', function(uiLoad, $ocLazyLoad) {
						return uiLoad.load('src/app/dm/maintain/maintainCreateController.js').then(function() {
							return $ocLazyLoad.load('toaster');
						});
					}]
				}
			})
			.state('main.dm.DmMaintain.mainTainDetials', {
				url: '/DmMaintain/mainTainDetials/{id}?params',
				templateUrl: 'src/app/dm/maintain/mainTainDetials.html',
				controller: 'mainTainDetailsController',
				resolve: {
					deps: ['uiLoad', '$ocLazyLoad', function(uiLoad, $ocLazyLoad) {
						return uiLoad.load('src/app/dm/maintain/mainTainDetailsController.js').then(function() {
							return $ocLazyLoad.load('toaster');
						});
					}]
				}
			})

	}])
	.controller("navCtrl", function($rootScope, $state, $scope) {
		$.ajax({
			url: '/user/read/promission?timestamp=' + new Date().getTime(),
			success: function(result) {
				if(result.httpCode == 200) {
					$rootScope.userInfo = result.user;
					$rootScope.menuList = result.menus;
					localStorage.setItem("userInfo",JSON.stringify(result.user));//储存用户信息
					$scope.$apply();
				}
			},
			error: function(result) {
				console.log(result.msg);
			}
		});
	})
	.run(['$rootScope', '$state', '$stateParams', '$timeout', '$templateCache',
		function($rootScope, $state, $stateParams, $timeout, $templateCache) {
			$rootScope.$state = $state;
			$rootScope.$stateParams = $stateParams;
			$rootScope.$on('$stateChangeStart', function(event, toState, toParams, fromState, fromParams) {
				var from = fromState.name,
					to = toState.name;
				if(from && to) { // 解决 相应模块从列表进入编辑后 状态丢失问题
					var s1 = from.substring(0, from.lastIndexOf(".")),
						g1 = from.substring(from.lastIndexOf(".") + 1),
						s2 = to.substring(0, to.lastIndexOf(".")),
						g2 = to.substring(to.lastIndexOf(".") + 1);
					if(s1 == s2) {
						if(g1 == 'list' && (g2 == 'update' || g2 == 'view')) { //进行编辑
							toParams['params'] = window.location.hash;
						}
						//返回列表
						if((g1 == "update" || g1 == 'view') && g2 == 'list') {
							var h = fromParams['params'];
							if(h) {
								$timeout(function() {
									window.location.hash = h;
								});
							}
						}
					}
				}
			});

		}

	]);